using System.ComponentModel.DataAnnotations;

namespace FServer.Core.Entities;

/// <summary>
/// 游戏服务器信息
/// </summary>
public class GameServer
{
    public Guid Id { get; set; }
    
    /// <summary>
    /// 服务器名称
    /// </summary>
    [Required]
    [MaxLength(100)]
    public string Name { get; set; } = string.Empty;
    
    /// <summary>
    /// 服务器标识
    /// </summary>
    [Required]
    [MaxLength(50)]
    public string ServerId { get; set; } = string.Empty;
    
    /// <summary>
    /// 服务器类型 (Main, Battle, Chat, Mail)
    /// </summary>
    [Required]
    [MaxLength(20)]
    public string ServerType { get; set; } = "Main";
    
    /// <summary>
    /// 服务器状态 (Online, Offline, Maintenance, Full)
    /// </summary>
    [Required]
    [MaxLength(20)]
    public string Status { get; set; } = "Online";
    
    /// <summary>
    /// 服务器IP地址
    /// </summary>
    [Required]
    [MaxLength(45)]
    public string IpAddress { get; set; } = string.Empty;
    
    /// <summary>
    /// TCP端口 (主游戏)
    /// </summary>
    public int TcpPort { get; set; } = 8080;
    
    /// <summary>
    /// KCP端口 (战斗)
    /// </summary>
    public int KcpPort { get; set; } = 8081;
    
    /// <summary>
    /// HTTP端口 (API)
    /// </summary>
    public int HttpPort { get; set; } = 8082;
    
    /// <summary>
    /// WebSocket端口 (聊天)
    /// </summary>
    public int WebSocketPort { get; set; } = 8083;
    
    /// <summary>
    /// 最大连接数
    /// </summary>
    public int MaxConnections { get; set; } = 10000;
    
    /// <summary>
    /// 当前连接数
    /// </summary>
    public int CurrentConnections { get; set; } = 0;
    
    /// <summary>
    /// 服务器负载 (0-100)
    /// </summary>
    public int LoadPercentage { get; set; } = 0;
    
    /// <summary>
    /// 服务器繁忙程度 (Low, Medium, High, Full)
    /// </summary>
    [MaxLength(20)]
    public string BusyLevel { get; set; } = "Low";
    
    /// <summary>
    /// 服务器区域
    /// </summary>
    [MaxLength(50)]
    public string? Region { get; set; }
    
    /// <summary>
    /// 服务器描述
    /// </summary>
    public string? Description { get; set; }
    
    /// <summary>
    /// 是否推荐
    /// </summary>
    public bool IsRecommended { get; set; } = false;
    
    /// <summary>
    /// 是否启用
    /// </summary>
    public bool IsEnabled { get; set; } = true;
    
    /// <summary>
    /// 最后心跳时间
    /// </summary>
    public DateTime LastHeartbeat { get; set; } = DateTime.UtcNow;
    
    /// <summary>
    /// 创建时间
    /// </summary>
    public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
    
    /// <summary>
    /// 更新时间
    /// </summary>
    public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
}
